<style type="text/css">
#resetpass_win { text-align:center; margin-top:20px; }
#resetpass_win div u { margin: 3px; color: red; }
#resetpass_win div span { color: #ccc; }
.bottom_ad { margin-top: 20px; text-align: center; }
#resetpass_win span { color: white; }
#resetpass_win a { color: blue; text-decoration: underline; }
#resetpass_win a:hover { color: red; background-color: #fff; }
#resetpass_win a.whitelink { color:#fff; text-decoration: underline; }
#resetpass_win a.whitelink:hover { color:#fff; text-decoration: underline overline; background-color: transparent; }
</style>
<div id="resetpass_win">

	<h3>重置密码</h3>
	<div style="text-align:left; width:500px; margin:0 auto; padding: 5px 10px;">
	<% if(@success) %>
	<div>亲爱的<u><%=@name%></u>，你好：
		<br/>请重新设置您的登陆密码：<input id="newpass" type="password" style="width:120px;" /> <span>(不能少于6个字符)</span>
		<br/><input type="button" id="btnNext" value="完成" class="btn btn-primary" />
			<span id="errtip" class="label label-warning" style="display:none; color:#fff;"></span>
			<span class="label label-success" style="color:#fff; display:none" id="successtip">密码设置成功，请您牢记。您可以点击这里：<a class="whitelink" href="/user/login?source=resetpass">登陆系统</a>。</span>
	</div>

	<% else %>
	<div>亲爱的，对不起 -_-! &nbsp;该链接地址错误，或已失效。
		<br/>如果您忘记了登陆密码，请点击这里：<a href="/user/forgetpass">找回密码</a> ， 或者<a href="/feedback">给我们留言</a>。</div>
	<% end %>
	</div>
</div>

	<div class="bottom_ad">
<script type="text/javascript">
/*728*90，创建于2013-3-19*/
var cpro_id = "u1238875";
</script>
<script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script>
	</div>	

<script type="text/javascript">
// 隐藏提示语
function hideerr() {
	$('#errtip').hide();
	$('#successtip').hide();
}

// 显示错误提示语
function showerr(err) {
	$('#errtip').show().html(err);
}
$(document).ready(function(){
	$('#btnNext').click(function(){
		hideerr();
		var pwd = $('#newpass').val();
		if(pwd.length < 6){
			showerr('密码格式错误');
			return;
		}
		$.post('/user/resetpass_post', {
			'uid' : '<%=request[:uid]%>',
			'token' : '<%=request[:token]%>',
			'pass' : pwd
		}, function(data){
			if(data.state == 0){
				showerr('重置密码错误，服务端发生异常，请重新尝试。');
			} else {
				$('#successtip').show();
				$('#btnNext').attr('disabled', true);
			}
		}, 'json');
	});
});
</script>
